$.ajax({
    type: "Get",
    url: "http://chst.vip:1234/api/getcoupon",
    data:{},
    success(res){
        var html=""
        console.log(res.result);
        res.result.forEach(item => {
            var linkhref="./"+item.couponLink;
            html+=`
                <div class="couponItem" couponid=${item.couponId}>
                    <img src=${item.couponImg}>
                    <p>${item.couponTitle}</p>
                </div>
            `
        });
        $("main").html(html);

    }
}).then(res=>{
   
    $("main").on("click", ".couponItem", function () {
           
          
       let couponid = $(this).attr("couponid");
       let title = $($(this).children()[1]).html();
       location.href = `./couponproduct.html?couponid=${couponid}&title=${title}`
   })
})